<?php

class Registration extends _Controller
{
    private $users;

    public function __construct()
    {
        $this->importHelper('users');
        $this->users = new Users();
    }

    public function get()
    {
        $this->parseTemplate('registration');
    }

    public function post()
    {
        $res = $this->users->Register(array('UserName' => $_POST['username'],
                                             'UserEmail' => $_POST['mail'],
                                             'FirstName' => $_POST['firstname'],
                                             'LastName' => $_POST['lastname'],
                                             'Password' => $_POST['password'],
                                             'PasswordRepeat' => $_POST['password_repeat']));

        switch($res)
        {
            case 'UserNameInvalid':
            case 'UserEmailInvalid':
            case 'PasswordInvalid':
            case 'UserNameExists':
            case 'UserEmailExists':
            case 'PasswordsDontMatch':
            case 'Added':
                die($res);
        }

        dump($res);
    }
}